package com.pet.shop.utils;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class MyRequestFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        MyRequestWrapper myRequest = new MyRequestWrapper((HttpServletRequest)request);
        myRequest.setResponse((HttpServletResponse)response);
        chain.doFilter(myRequest, response);
    }

    @Override
    public void destroy() {

    }
}